package com.work.api.transport;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.work.dto.main.TransportCorpSearchDTO;
import com.work.dto.transport.TransportSearchDTO;
import com.work.dto.transport.WorkArrangeSearchDTO;
import com.work.service.transport.ITransportService;
import com.work.vo.transport.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 货运控制器
 *
 * @author ：dujianyu
 * @since ：Created in 2024/2/20 13:47
 */
@RestController
@AllArgsConstructor
@RequestMapping("transport")
@Api(value = "基础数据-作业过程控制器", tags = "基础数据-作业过程控制器")
public class TransportController extends BladeController {

    private ITransportService service;

    @GetMapping("/shipList")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "货运船", notes = "传入dto")
    public R<List<TransportShipVO>> transportShipList(TransportSearchDTO dto) {
        List<TransportShipVO> list = service.selectTransportShipList(dto);
        return R.data(list);
    }

    @GetMapping("/billList")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "货运舱单", notes = "传入dto")
    public R<List<TransportBillVO>> transportBillList(TransportSearchDTO dto) {
        List<TransportBillVO> list = service.selectTransportBillList(dto);
        return R.data(list);
    }

    @GetMapping("/packageTypeList")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "货运包装", notes = "传入dto")
    public R<List<TransportPackageTypeVO>> transportPackageTypeList(TransportSearchDTO dto) {
        List<TransportPackageTypeVO> list = service.selectTransportPackageTypeList(dto);
        return R.data(list);
    }

    @GetMapping("/getCODE")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "货运包装code", notes = "传入dto")
    public R<String> getName(String code) {
        return R.data(service.getPackageTypeNameByCode(code));
    }

    @GetMapping("/getShipCargoType")
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "获取该船舱单的货名", notes = "传入dto")
    public R<List<CargoTypeVO>> getShipCargoType(TransportSearchDTO dto) {
        return R.data(service.getShipCargoType(dto));
    }

    @GetMapping("/getShipArrange")
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "航运配工", notes = "传入dto")
    public R<List<WorkArrangeShipVO>> getShipArrange(WorkArrangeSearchDTO dto) {
        return R.data(service.selectWorkArrangeShipList(dto));
    }

    @GetMapping("/getLandArrange")
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "陆运配工", notes = "传入dto")
    public R<List<WorkArrangeLandVO>> getLandArrange(WorkArrangeSearchDTO dto) {
        return R.data(service.selectWorkArrangeLandList(dto));
    }

    @GetMapping("/getAssignWorker")
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "配工工人", notes = "传入dto")
    public R<List<AssignWorkerVO>> getAssignWorker(WorkArrangeSearchDTO dto) {
        return R.data(service.selectAssignWorkerList(dto));
    }

    @GetMapping("/getAssignMachine")
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "配工机械", notes = "传入dto")
    public R<List<AssignMachineKindVO>> getAssignMachine(WorkArrangeSearchDTO dto) {
        return R.data(service.selectAssignMachineList(dto));
    }

    @GetMapping("/getCorpTeam")
    @ApiOperationSupport(order = 6)
    @ApiOperation(value = "队组", notes = "传入dto")
    public R<List<CorpTeamVO>> getCorpTeam(TransportCorpSearchDTO dto) {
        return R.data(service.selectCorpTeamList(dto));
    }

    @GetMapping("/cargoTypeList")
    @ApiOperationSupport(order = 7)
    @ApiOperation(value = "货名", notes = "传入dto")
    public R<List<CargoTypeVO>> cargoTypeList(TransportSearchDTO dto) {
        return R.data(service.selectCargoTypeList(dto));
    }

    @GetMapping("/clientCodeList")
    @ApiOperationSupport(order = 8)
    @ApiOperation(value = "客户列表", notes = "传入dto")
    public R<List<ClientCodeVO>> clientCodeList(TransportSearchDTO dto) {
        return R.data(service.selectClientCodeList(dto));
    }

}
